﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using TSSControlLibrary;
using TaskSchedulingSystemForm.Model;

namespace TaskSchedulingSystemForm.Model
{
    /// <summary>
    /// 任务调度系统专属输入输出
    /// </summary>
    public static class DIYConsole
    {
        static List<TaskModel> taskCarryNowLst;
        static Action<string,int> doWriteMsg;
        ///// <summary>
        ///// 静态构造函数
        ///// </summary>
        ///// <param name="u"></param>
        ///// <param name="ATaskIdAndStatePool"></param>
        ///// <param name="AtaskCarryNowLst"></param>
        //static DIYConsole(DisPlayIOInfoUserControl u, Dictionary<int, bool> ATaskIdAndStatePool, List<TaskModel> AtaskCarryNowLst)
        //{
        //    userControl = u;
        //    TaskIdAndStatePool = ATaskIdAndStatePool;
        //    taskCarryNowLst = AtaskCarryNowLst;
        //}
        /// <summary>
        /// 初始化自定义输入输出
        /// </summary>
        /// <param name="u"></param>
        /// <param name="TaskIdAndStatePool"></param>
        public static void InitializeConsole( List<TaskModel> AtaskCarryNowLst,Action<string,int> arg)
        {         
            taskCarryNowLst = AtaskCarryNowLst;
            doWriteMsg = arg;
        }
        /// <summary>
        /// 输出一行
        /// </summary>
        public static void WriteLine(string value, int taskId)
        {
            doWriteMsg(value, taskId);
        }
        public static void WriteLine(string format, object arg0, int taskId)
        {
            doWriteMsg(string.Format(format, arg0), taskId);
         
        }
        public static void WriteLine(string format, object arg0, object arg1, int taskId)
        {
            doWriteMsg(string.Format(format, arg0, arg1), taskId);         
        }
        public static void WriteLine(string format, object arg0, object arg1, object arg2, int taskId)
        {
            doWriteMsg(string.Format(format, arg0, arg1, arg2), taskId);
          
        }
        public static void WriteLine(string format, object arg0, object arg1, object arg2, object arg3, int taskId)
        {
            doWriteMsg(string.Format(format, arg0, arg1, arg2, arg3), taskId);           
        }
        /// <summary>
        /// 读入一行
        /// </summary>
        public static string ReadLine()
        {
            return Console.ReadLine();
        }
    }
}
